package com.ruibang.glass.equipment.job;

import com.ruibang.glass.equipment.service.PointCheckPlanService;

import com.teaming.cloud.framework2.elastic.job3.annotation.ElasticJobScheduler;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 基于注解形式script job
 *
 *
 * 点检计划落到任务 按天执行
 */
@Service
@ElasticJobScheduler(cron = "0 0/30 * * * ?", name = "EqPointDayDataElasticJob")
@Slf4j
public class EqPointDayDataElasticJob implements SimpleJob {
    @Autowired
    private PointCheckPlanService pointCheckPlanService;

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("===========================定时任务点检计划按天建任务开始执行====================");
        pointByDay();
        log.info("===========================定时任务点检计划按天建任务执行结束====================");
    }

    public void pointByDay() {
        pointCheckPlanService.checkByDayPoint();
    }
}
